#include <stdint.h>
#include "udp_def.h"
#include "udf_cfg.h"
#include "udf_global.h"
#include "udf.h"

#ifdef UDP_SUB_PROJECT
#define UDP_ANA_CRC (0)
#define UDP_DATAPREP_CRC (0)
#define UDP_ALG_CRC (0)
#define UDP_FUNC_CRC (0)
#define UDP_RSV_CRC (0)
#else
#include "udp_def_auto.h"
#endif

#undef BBE_ABUF0_OFFSET
#undef BBE_ABUF1_OFFSET
#undef BBE_ABUF2_OFFSET
	
/*
	UDP 参数定义
*/
#if defined(UDF_SUB_PROJECT)
const UDP_2K_t UDP_2k_Const = {
#elif defined(UDP_SUB_PROJECT) || defined(UDF_PRJ)
const UDP_2K_t UDP_2k_Const __attribute__((section(".ARM.__at_0x0000C000"))) = {
#else 
const UDP_2K_t UDP_2k_Const = { //__attribute__((section(".ARM.__at_0x00005000"))) = {
#endif


	.paraANA.ana1.ana_cfg0   = UDPCFG_ANA1_CFG0,
	.paraANA.ana1.ana_cfg1   = UDPCFG_ANA1_CFG1,
	.paraANA.ana1.ana_cfg2   = UDPCFG_ANA1_CFG2,
  
	.paraANA.ana2.ana_cfg0   = UDPCFG_ANA2_CFG0,
	.paraANA.ana2.ana_cfg1   = UDPCFG_ANA2_CFG1,
	.paraANA.ana2.ana_cfg2   = UDPCFG_ANA2_CFG2,
  
	.paraANA.ana3.ana_cfg0   = UDPCFG_ANA3_CFG0,
	.paraANA.ana3.ana_cfg1   = UDPCFG_ANA3_CFG1,
	.paraANA.ana3.ana_cfg2   = UDPCFG_ANA3_CFG2,
  
	.paraANA.ana4.ana_cfg0   = UDPCFG_ANA4_CFG0,
	.paraANA.ana4.ana_cfg1   = UDPCFG_ANA4_CFG1,
	.paraANA.ana4.ana_cfg2   = UDPCFG_ANA4_CFG2,

	.paraANA.ramp_pll_cfg    = UDPCFG_RAMP_PLL,    //freq start  23.6G
	.paraANA.ramp_syncw_cfg  = UDPCFG_SYNCW,       //sync  3210
	.paraANA.ramp_chirpw_cfg = UDPCFG_CHIRPW,      //acc   210
	.paraANA.ramp_wm_cfg0    = UDPCFG_RAMP_WM,     //circle mode
														 
	.paraANA.ramp_mem03      = UDPCFG_RAMP_WAVE0_A,   //A: 10us     0G  
	.paraANA.ramp_mem02      = UDPCFG_RAMP_WAVE0_B,   //B: 1us     0G
	.paraANA.ramp_mem01      = UDPCFG_RAMP_WAVE0_C,   //c: 10us     0G
	.paraANA.ramp_mem00      = UDFDEF_RAMP_WAVE0_R,
	
	.paraANA.ramp_mem13      = UDPCFG_RAMP_WAVE1_A,   //A:  10us     0G
	.paraANA.ramp_mem12      = UDPCFG_RAMP_WAVE1_B,   //B: 110us  0.22G
	.paraANA.ramp_mem11      = UDPCFG_RAMP_WAVE1_C,   //c:  30us -0.22G
	.paraANA.ramp_mem10      = UDFDEF_RAMP_WAVE1_R,  // covered by udf03

	.paraANA.crcLen = 96, // 96
	.paraANA.crcVal = UDP_ANA_CRC,


	/************************************paraDataPrep***************************************/
//	.paraDataPrep.calibAnt2_r = 6899,								
//	.paraDataPrep.calibAnt2_i = -1172,							
	.paraDataPrep.calibAnt2_r = 6611,								
	.paraDataPrep.calibAnt2_i = -1153,	
	
	.paraDataPrep.angleDstAddr = GET_OFFSET(UDFDEF_ADDR_ARRAY_CALIB),				
	.paraDataPrep.angleFlashLen = NUM_ANGLE * UDFDEF_ANT_NUM * NUM_BYTE32, 


	// winRange
	#if defined(FLASH_WINRANGE)
	#if(UDFDEF_ADCSAMP_NUM == 64)
	.paraDataPrep.winRange.srcFlashAddr = 0x4e00,
	#elif( UDFDEF_ADCSAMP_NUM == 256 )
	.paraDataPrep.winRange.srcFlashAddr = 0x4C00,
	#else
	#error xxxx
	#endif
	.paraDataPrep.winRange.len = UDFDEF_ADCSAMP_NUM*2,
	.paraDataPrep.constFlashEn = 0,
	#else
	.paraDataPrep.winRange.len = UDFDEF_ADCSAMP_NUM,
	.paraDataPrep.constFlashEn = 0,
	#endif
	
	.paraDataPrep.winRange.srcInc = 2 * 256 / UDFDEF_ADCSAMP_NUM,
	.paraDataPrep.winRange.dstOffsetAddr = GET_OFFSET(UDFDEF_ADDR_WIN_RANGE), 
	.paraDataPrep.winRange.dstInc = 2,

	// // winVel
	// .paraDataPrep.winVel.len = UDFDEF_CHIRP_NUM,
	// .paraDataPrep.winVel.dstOffsetAddr = GET_OFFSET(UDFDEF_ADDR_WIN_VEL), 
	// .paraDataPrep.winVel.srcInc = 2 * 256 / UDFDEF_CHIRP_NUM,
	// .paraDataPrep.winVel.dstInc = 2,
	
	.paraDataPrep.constEn = CONST_WINRANGE_EN,// | CONST_WINVEL_EN |CONST_ANGLE_EN,
	
	#if !defined(FLASH_WINRANGE)
	
	#endif

	.paraDataPrep.prepCfg0 = UDPCFG_DP_CFG0,
	.paraDataPrep.prepCfg1 = UDPCFG_DP_CFG1,
	.paraDataPrep.prepCfg2 = UDPCFG_DP_CFG2,
		
	.paraDataPrep.cycleNum = UDFDEF_CYCLE_NUM,

	.paraDataPrep.sweepMode = SWEEP_MODE_CHIRP_SUM, // 1:continue  2:interval 3:chirp-sum
	.paraDataPrep.lowPower = LOWPOWER_DIS,

	.paraDataPrep.crcLen = 75, //
	.paraDataPrep.crcVal = UDP_DATAPREP_CRC,
		
	/************************************alg***************************************/
	.paraALG.algEn = ALG0_EN|ALG1_EN|ALG2_EN|ALG11_EN|ALG12_EN|ALG20_EN|ALG23_EN,
	
	#if 1 /*alg0 chirpsum */
	/*alg0*/ //chirpsum
	// intraCnt,fix2pfLsfB,max_clr,p2_fft_mode,dma_dsize,rsfBit,sub_mode,mode
	.paraALG.alg0.p2Cfg0 = (UDFDEF_CHIRP_SUM_NUM - 1) << 20 |       // covered by udf03
							P2_FIX2PF_LSFB_0BIT << 17 |
							P2_MAX_CLR_EN << 16 |
							P2_FFT_MODE_DIS << 14 |
							P2_DMA_DSIZE_8BIT << 12 |
							P2_RSF_DIV1 << 8 |
							P2_SUBMODE_0 << 4 |
							P2_MODE_ACC,  // covered by udf03 code
	// jumpCnt,interCnt
	.paraALG.alg0.p2Cfg1 = (UDFDEF_ANT_NUM-1) << 12 | (UDFDEF_ADCSAMP_NUM - 1) << 0,
	// ncoMode,nco_fcw
	.paraALG.alg0.p2Cfg2 = (0) << 24 | (0) << 0,
	// src0JumpInc,src0InterInc
	.paraALG.alg0.p2Cfg3 = (NUM_BYTE8*UDFDEF_ADCSAMP_NUM) << 16 | (NUM_BYTE8) << 0,
	// src0IntraInc,src0BaseAddr
	.paraALG.alg0.p2Cfg4 = (NUM_BYTE8*UDFDEF_ADCSAMP_NUM*UDFDEF_ANT_NUM) << 16 | (GET_OFFSET(UDFDEF_ADDR_ADCSAMP)) << 0,
	// src1JumpInc,src1InterInc
	.paraALG.alg0.p2Cfg5 = (0) << 16 | (0) << 0,
	// src1IntraInc,src1BaseAddr
	.paraALG.alg0.p2Cfg6 = (0) << 16 | (0) << 0,
	// dstJumpInc,dstInterInc
	.paraALG.alg0.p2Cfg7 = (UDFDEF_ADCSAMP_NUM*NUM_BYTE32) << 16 | (NUM_BYTE32) << 0,
	// dstIntraInc,dstBaseAddr
	.paraALG.alg0.p2Cfg8 = (0) << 16 | (GET_OFFSET(UDFDEF_ADDR_CHIRPSUM)) << 0,
	.paraALG.alg0_dstInc = 0,
	#endif
	
	#if 1 /*alg1 fft1d */
	//intraCnt,fix2pfLsfB,max_clr,p2_fft_mode,dma_dsize,rsfBit,sub_mode,mode		
	.paraALG.alg1.p2Cfg0 = (UDFDEF_ADCSAMP_NUM-1)<< 20|
													P2_FIX2PF_LSFB_0BIT<<17|
													P2_MAX_CLR_EN<<16 |
													P2_FFT_MODE_EN<<14|
													P2_DMA_DSIZE_32BIT<<12|
													P2_RSF_DIV1<<8|
													P2_SUBMODE_0<<4|
													P2_MODE_DMA,
	//jumpCnt,interCnt
	.paraALG.alg1.p2Cfg1 = (UDFDEF_ANT_NUM-1)<< 12 | (0)<<0,//(UDF_CHIRP_NUM-1)<< 0, //TODO
	//ncoMode,nco_fcw
	.paraALG.alg1.p2Cfg2 = (0)<< 24 |(0)<< 0,
	//src0JumpInc,src0InterInc
	.paraALG.alg1.p2Cfg3 = (UDFDEF_ADCSAMP_NUM*NUM_BYTE32)<<16 |(0)<<0,//(CHIRPSUM_INTERVAL)<< 0,
	//src0IntraInc,src0BaseAddr		          
	.paraALG.alg1.p2Cfg4 = (NUM_BYTE32)<<16 |(GET_OFFSET(UDFDEF_ADDR_CHIRPSUM))<< 0, // covered by udf03
	//src1JumpInc,src1InterInc		           
	.paraALG.alg1.p2Cfg5 = (0)<<16 |(0)<< 0,
	//src1IntraInc,src1BaseAddr            
	.paraALG.alg1.p2Cfg6 = (0)<<16 |(0)<< 0,		
	//dstJumpInc,dstInterInc                
	.paraALG.alg1.p2Cfg7 = (UDFDEF_RANGE_USE*NUM_BYTE32)<<16 |(0)<<0,//(UDF_ADDR_FFT1D_FRAME1_CACHE-UDF_ADDR_FFT1D_FRAME0_CACHE)<< 0,
	//dstIntraInc,dstBaseAddr               
	.paraALG.alg1.p2Cfg8 = (NUM_BYTE32)<<16 |(GET_OFFSET(UDFDEF_ADDR_FFT1D))<< 0, // covered by udf03
	
	//inPt,fftPt,mode
	.paraALG.alg1.fftCfg0 = (UDFDEF_ADCSAMP_NUM - 1) << 8 | (FFT_PT256) << 4 | (FFT_MODE_FORWARD) << 0,
	//useA,useB
	.paraALG.alg1.fftCfg1 = (0) << 8 | (UDFDEF_RANGE_USE- 1) << 0,
	//winBaseAddr,winSize,winEn
	#ifdef WINRANGE_ENABLE
	.paraALG.alg1.fftCfg2 = (uint32_t)(GET_OFFSET(UDFDEF_ADDR_WIN_RANGE)) << 16 | (FFT_WIN_SIZE_14BIT) << 1 | (FFT_WIN_DIS) << 0,
	#else
	.paraALG.alg1.fftCfg2 = (uint32_t)(GET_OFFSET(UDFDEF_ADDR_WIN_RANGE)) << 16 | (FFT_WIN_SIZE_14BIT) << 1 | (FFT_WIN_DIS) << 0,
	#endif
	#endif
	
	#if 1 /*alg2 fft1d minus */
	// intraCnt,fix2pfLsfB,max_clr,p2_fft_mode,dma_dsize,rsfBit,sub_mode,mode
	.paraALG.alg2.p2Cfg0 = (UDFDEF_RANGE_USE-1)<< 20|
													P2_FIX2PF_LSFB_0BIT<<17|
													P2_MAX_CLR_EN<<16 |
													P2_FFT_MODE_DIS<<14|
													P2_DMA_DSIZE_32BIT<<12|
													P2_RSF_DIV1<<8|
													P2_SUBMODE_2<<4|
													P2_MODE_ADD,
	//jumpCnt,interCnt
	.paraALG.alg2.p2Cfg1 = (UDFDEF_BKUP_FRAME_NUM-1)<< 12 |(UDFDEF_ANT_NUM-1)<< 0,
	//ncoMode,nco_fcw
	.paraALG.alg2.p2Cfg2 = (0)<< 24 |(0)<< 0,
	//src0JumpInc,src0InterInc
	.paraALG.alg2.p2Cfg3 = (UDFDEF_RANGE_USE*NUM_BYTE32*UDFDEF_ANT_NUM)<<16 |(UDFDEF_RANGE_USE*NUM_BYTE32)<< 0,	
	//src0IntraInc,src0BaseAddr		          
	.paraALG.alg2.p2Cfg4 = (NUM_BYTE32)<<16 |(GET_OFFSET(UDFDEF_ADDR_FRAME_RECOVER_FFT1D_OLD ))<< 0,
	//src1JumpInc,src1InterInc		           
	.paraALG.alg2.p2Cfg5 = (0)<<16 |(UDFDEF_RANGE_USE*NUM_BYTE32)<< 0,	
	//src1IntraInc,src1BaseAddr            
	.paraALG.alg2.p2Cfg6 = (NUM_BYTE32)<<16 |(GET_OFFSET(UDFDEF_ADDR_FFT1D))<< 0,		
	//dstJumpInc,dstInterInc                
//	.paraALG.alg2.p2Cfg7 = (UDFDEF_RANGE_USE*NUM_BYTE32)<<16 |(UDFDEF_RANGE_USE*UDFDEF_ANT_NUM*NUM_BYTE32)<< 0,	
	.paraALG.alg2.p2Cfg7 = (UDFDEF_RANGE_USE*NUM_BYTE32*UDFDEF_ANT_NUM)<<16 |(UDFDEF_RANGE_USE*NUM_BYTE32)<< 0,	
	//dstIntraInc,dstBaseAddr               
	.paraALG.alg2.p2Cfg8 = (NUM_BYTE32)<<16 |(GET_OFFSET(UDFDEF_ADDR_FFT1D_MINUS))<< 0,
	#endif
	
	#if 1 /*alg9 abs mean */
	/*alg9*/
	// intraCnt,fix2pfLsfB,max_clr,p2_fft_mode,dma_dsize,rsfBit,sub_mode,mode
	.paraALG.alg9.p2Cfg0 = (UDFDEF_RANGE_USE - 1) << 20 |
	P2_FIX2PF_LSFB_0BIT << 17 |
	P2_MAX_CLR_EN << 16 |
	P2_FFT_MODE_DIS << 14 |
	P2_DMA_DSIZE_32BIT << 12 |
	P2_RSF_DIV64 << 8 |
	P2_SUBMODE_1 << 4 |
	P2_MODE_ACC,  // covered by udf03 code
	// jumpCnt,interCnt
	.paraALG.alg9.p2Cfg1 = (1 - 1) << 12 | (1 - 1) << 0,
	// ncoMode,nco_fcw
	.paraALG.alg9.p2Cfg2 = (0) << 24 | (0) << 0,
	// src0JumpInc,src0InterInc
	.paraALG.alg9.p2Cfg3 = (0) << 16 | (0) << 0,
	// src0IntraInc,src0BaseAddr
	.paraALG.alg9.p2Cfg4 = (NUM_BYTE32) << 16 | (GET_OFFSET(UDFDEF_ADDR_FFT1D_ANT1_MINUS_OLD)) << 0,
	// src1JumpInc,src1InterInc
	.paraALG.alg9.p2Cfg5 = (0) << 16 | (0) << 0,
	// src1IntraInc,src1BaseAddr
	.paraALG.alg9.p2Cfg6 = (0) << 16 | (0) << 0,
	// dstJumpInc,dstInterInc
	.paraALG.alg9.p2Cfg7 = (0) << 16 | (0) << 0,
	// dstIntraInc,dstBaseAddr
	.paraALG.alg9.p2Cfg8 = (0) << 16 | (GET_OFFSET(BBE_ABUF0_BASE)) << 0,
	#endif

	
	#if 1 /* alg11 range-cfar */
	//pdEn,cfarMode,wkMode	
	.paraALG.alg11_cfar2.cfarCfg0= (CFAR_PEAKDET_EN)<< 8 |(CFAR_CFARMODE_SO  )<< 4|(CFAR_WKMODE_CFAR)<< 0,
	//interCnt,intraCnt	
	.paraALG.alg11_cfar2.cfarCfg1= (UDFDEF_BKUP_FRAME_NUM)<< 12 |(UDFDEF_RANGE_USE)<< 0,
	//wrapDirA,wrapDirB,thresDiv,divFac,mulFac,searchSize,guardSize
	.paraALG.alg11_cfar2.cfarCfg2= (0)  << 25|(0)  << 24|(CFAR_THRESDIV4)  << 20|(CFAR_DIVFAC1) << 16|(UDFDEF_CFAR_RTH) << 8| (UDFDEF_CFAR_RS)<< 4|(UDFDEF_CFAR_RG) << 0,//default:2
	//cutThres	
	.paraALG.alg11_cfar2.cfarCfg3= (0) << 0,
	//targetLim
	.paraALG.alg11_cfar2.cfarCfg4= (CFAR_MAX_NUM-1)<< 0,
	 //srcInterInc  
	.paraALG.alg11_cfar2.cfarCfg5= (UDFDEF_RANGE_USE*NUM_BYTE32)<< 0,
	 //srcIntraInc,srcBaseAddr 
	.paraALG.alg11_cfar2.cfarCfg6= (NUM_BYTE32)<< 16 |(GET_OFFSET(UDFDEF_ADDR_FFT2D))<< 0,
	//wrapAddrA,wrapAddrB	
//	.paraALG.alg11_cfar2.cfarCfg7= (uint32_t )(GET_OFFSET(UDFDEF_ADDR_FFT2D)+(UDFDEF_CFAR_RS+UDFDEF_CFAR_RG)*NUM_BYTE32)<< 16|
//	 (GET_OFFSET(UDFDEF_ADDR_FFT2D)+(UDFDEF_RANGE_USE-2)*NUM_BYTE32)<< 0,

	.paraALG.alg11_cfar2.cfarCfg7= (uint32_t )(GET_OFFSET(UDFDEF_ADDR_FFT2D)+(UDFDEF_RANGE_USE - UDFDEF_CFAR_RS - UDFDEF_CFAR_RG)*NUM_BYTE32)<< 16|
	 (GET_OFFSET(UDFDEF_ADDR_FFT2D))<< 0,
	//dstBaseAddr	
	.paraALG.alg11_cfar2.cfarCfg8= (GET_OFFSET(UDFDEF_ADDR_CFAR2_CACHE)) << 0,
	
	.paraALG.cfarAbsAddr   = UDFDEF_ADDR_FFT2D + BBE_ABS_OFFSET,
	.paraALG.cfarUseRange  = UDFDEF_RANGE_USE,
	.paraALG.framePackAddr = UDFDEF_ADDR_POINT_RST,
	#endif

	#if 1 /* alg12 ant1 fft3d pre */
	// ALG12: FFT3D_Pre ANT1 ��ant2
	.paraALG.alg12.srcAddr = UDFDEF_ADDR_FFT1D_ANT1_MINUS_OLD,
	.paraALG.alg12.intraCnt = 1,
	.paraALG.alg12.interCnt = 0,
	.paraALG.alg12.dstAddr = UDFDEF_ADDR_FFT3D_PRE,
	#endif
	
	#if 1 /* alg20 ant2 fft3d pre */
	// ALG20: FFT3D_Pre ANT2 ��ant1
	.paraALG.alg20.srcAddr = UDFDEF_ADDR_FFT1D_ANT2_MINUS_OLD,//UDFDEF_ADDR_FFT2D + 2*UDFDEF_RANGE_USE*NUM_BYTE32,
	.paraALG.alg20.intraCnt = 1,
	.paraALG.alg20.interCnt = 0,
	.paraALG.alg20.dstAddr = UDFDEF_ADDR_FFT3D_PRE + NUM_BYTE32,
	#endif

	#if 1
	// intraCnt,fix2pfLsfB,max_clr,p2_fft_mode,dma_dsize,rsfBit,sub_mode,mode
	.paraALG.alg23.p2Cfg0 = (UDFDEF_ANT_NUM - 1) << 20 |
							 P2_FIX2PF_LSFB_0BIT << 17 |
							 P2_MAX_CLR_EN << 16 |
							 P2_FFT_MODE_DIS << 14 |
							 P2_DMA_DSIZE_32BIT << 12 |
							 P2_RSF_DIV1 << 8 |
							 P2_SUBMODE_0 << 4 |
							 P2_MODE_MAC,
	// jumpCnt,interCnt
	.paraALG.alg23.p2Cfg1 = (NUM_ANGLE - 1) << 12 | (0) << 0,
	// ncoMode,nco_fcw
	.paraALG.alg23.p2Cfg2 = (0) << 24 | (0) << 0,
	// src0JumpInc,src0InterInc
	.paraALG.alg23.p2Cfg3 = (UDFDEF_ANT_NUM * NUM_BYTE32) << 16 | (0) << 0,
	// src0IntraInc,src0BaseAddr
	.paraALG.alg23.p2Cfg4 = (NUM_BYTE32) << 16 | (GET_OFFSET(UDFDEF_ADDR_ARRAY_CALIB) ) << 0,
	// src1JumpInc,src1InterInc
	.paraALG.alg23.p2Cfg5 = (0) << 16 | (0) << 0,
	// src1IntraInc,src1BaseAddr
	.paraALG.alg23.p2Cfg6 = (NUM_BYTE32) << 16 | (GET_OFFSET(UDFDEF_ADDR_FFT3D_PRE)) << 0,
	// dstJumpInc,dstInterInc
	.paraALG.alg23.p2Cfg7 = (NUM_BYTE32) << 16 | (0) << 0,
	// dstIntraInc,dstBaseAddr
	.paraALG.alg23.p2Cfg8 = (0) << 16 | (GET_OFFSET(UDFDEF_ADDR_ANGLE_RSLT)) << 0,
	#endif
	
	.paraALG.copyEn = 0,//COPY1_EN,
	.paraALG.copyFlashEn = 0,

	.paraALG.crcLen = 1338, // 1338
	.paraALG.crcVal = UDP_ALG_CRC,
	/******************************************************************************/
	
	/**************************************paraFunc*************************/
	.paraFunc.udf01_addr.srcAddr = UDF01_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf01_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf01_len = UDP_UDF_LEN(01),

	.paraFunc.udf02_addr.srcAddr = UDF02_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf02_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf02_len = UDP_UDF_LEN(02),

	.paraFunc.udf03_addr.srcAddr = UDF03_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf03_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf03_len = UDP_UDF_LEN(03),

	.paraFunc.udf04_addr.srcAddr = UDF04_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf04_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf04_len = UDP_UDF_LEN(04),

	.paraFunc.udf05_addr.srcAddr = UDF05_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf05_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf05_len = UDP_UDF_LEN(05),

	.paraFunc.udf06_addr.srcAddr = UDF06_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf06_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf06_len = UDP_UDF_LEN(06),

	.paraFunc.udf07_addr.srcAddr = UDF07_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf07_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf07_len = UDP_UDF_LEN(07),

	.paraFunc.udf08_addr.srcAddr = UDF08_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf08_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf08_len = UDP_UDF_LEN(08),

	.paraFunc.udf09_addr.srcAddr = UDF09_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf09_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf09_len = UDP_UDF_LEN(09),

	.paraFunc.udf10_addr.srcAddr = UDF10_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf10_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf10_len = UDP_UDF_LEN(10),

	.paraFunc.udf11_addr.srcAddr = UDF11_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf11_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf11_len = UDP_UDF_LEN(11),

	.paraFunc.udf12_addr.srcAddr = UDF12_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf12_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf12_len = UDP_UDF_LEN(12),

	.paraFunc.udf13_addr.srcAddr = UDF13_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf13_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf13_len = UDP_UDF_LEN(13),

	.paraFunc.udf14_addr.srcAddr = UDF14_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf14_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf14_len = UDP_UDF_LEN(14),

	.paraFunc.udf15_addr.srcAddr = UDF15_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf15_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf15_len = UDP_UDF_LEN(15),

	.paraFunc.udf16_addr.srcAddr = UDF16_SRC_ADDR + UDF_OFFSET,
	.paraFunc.udf16_addr.dstAddr = UDF_DST_ADDR + UDF_OFFSET,
	.paraFunc.udf16_len = UDP_UDF_LEN(16),
	
	//*******************************************************************************************************
	.paraFunc.udfEn        = UDF_EN,//1<<(3-1),
	.paraFunc.frameT0_msec   = 2357,
	.paraFunc.frameT1_msec   = 2457, //100=3.2ms   1ms=30.5cnt  3276
	.paraFunc.pro_func       = 2,
	#if UART_BAUDRATE == 0  
	.paraFunc.baudrate       = 2000000,
	#else  
	.paraFunc.baudrate       = 115200,
	#endif  
	.paraFunc.wdt_cnt        = 160000, // 1=31.25us   32K clock,  64000=2s 160000=5s
	.paraFunc.uartOutputAddr = UDFDEF_ADDR_UART_OUTPUT,

	.paraFunc.uartDebugAddr  = UDFDEF_ADDR_DEBUG_OUTPUT,
	
	#if defined(LED_TRIGGER_ENABLE)
	.paraFunc.gpio_pmode     = 0x000000000|(1<<LED_OUTPUT_GPIO), 
	#elif defined(TEST_LPW_GPIO)
	.paraFunc.gpio_pmode     = 0x000000000|(1<<4),
	#else
	.paraFunc.gpio_pmode     = 0x000000000, 
	#endif
	// GPIO0.5 GPIO0.4默认上拉
//	.paraFunc.gpio_pctrl_ue  = 0x000021D0,    // 0x000001C0,//all down
	.paraFunc.gpio_pctrl_ue  = 0x00002110,    // 0x000001C0,//all down
//	.paraFunc.gpio_pctrl_re  = 0x0000FFFE,    // 0x0000FFFE,//0.1 0.2 0.3 0.5 en res
  .paraFunc.gpio_pctrl_re  = 0x0000FF3E,
//	.paraFunc.gpio_pmux0     = 0x11000000,	   // usci1
	.paraFunc.gpio_pmux0     = 0x00000000,	   // usci1
	#if DYNALOAD_FW == 1
	.paraFunc.gpio_pmux1     = 0x00000000,	   // qspi
	#else
	.paraFunc.gpio_pmux1     = 0x00666666,	   // qspi
	#endif
	
	.paraFunc.uartDebugLen     = 0,
	.paraFunc.ab_area_flag     = 1,
	.paraFunc.AtCmdDelay       = 100,  // ms
	.paraFunc.ab_area_offset    = OTA_SIZE_MAX,
	.paraFunc.rtcCailbFrameCnt = 100,   // 100 frame calb 1
	.paraFunc.rtcCailbClkCnt   = 8,	 // 8 16 32 64 128

	.paraFunc.rangeIdxTh       = UDFDEF_RANGE_USE,
	.paraFunc.numTLVs          = 3,

	.paraFunc.uartDebugMode    = 0,				 // 0 uart 1:spi
	.paraFunc.rsv_crc          = UDP_RSV_CRC,
	
	#if TEST_MODE > 0
	.paraFunc.funcEn = FUNC_PROTOCOL_DIS|FUNC_DEBUG_DIS|FUNC_RTC_CALIB_DIS|FUNC_CRC_PATCH_EN|FUNC_SPI1_00_EN,
	#else
	.paraFunc.funcEn = FUNC_PROTOCOL_DIS|FUNC_DEBUG_DIS|FUNC_RTC_CALIB_DIS|FUNC_CRC_PATCH_EN|FUNC_SPI1_00_DIS,
	#endif
	.paraFunc.qspiMode = FLASH_INTERFACE,	// 0:single-line  1:4-line 2:sram

	.paraFunc.spi1_baudDiv       = 0,
	.paraFunc.crcLen             = 228,    // 228
	.paraFunc.crcVal             = UDP_FUNC_CRC,
	
	.paraRSV.startup_flag        = 1,
	#if defined(TEST_LPW)
	.paraRSV.frame_interval      = TEST_FRAME_INTERVAL*0.94, // 100ms 高帧率模式
	#else
	.paraRSV.frame_interval      = 53*0.94, // 100ms 高帧率模式
	#endif
	.paraRSV.sleep_time1         = 0*0.94,   // 0ms
	.paraRSV.sleep_time2         = 315*0.94, // 1000ms 低帧率模式
	.paraRSV.led_timeout         = 10,      // delay_time  = cnt * (sleep_time1+sleep_time2)

	.paraRSV.chirp_sum_cnt           = UDFDEF_CHIRP_SUM_NUM,
	.paraRSV.trigger_range_threshold = 100,//UDFDEF_RANGE_USE-1,
	.paraRSV.dbscan_minPts           = UDFDEF_DBSCAN_MINIPTS,
	.paraRSV.dbscan_epsRIdx          = UDFDEF_DBSCAN_EPS_R_IDX,
	.paraRSV.dbscan_epsVIdx          = UDFDEF_DBSCAN_EPS_V_IDX,
	.paraRSV.dbscan_epsSinPhiIdx     = UDFDEF_DBSCAN_EPS_SINPHI_IDX,
	.paraRSV.dbscan_mean_buffer_num  = UDFDEF_DBSCAN_MEAN_NUM,

	.paraRSV.divFac_temp = {
		4096, 2048, 1365, 1024, 819, 683, 585, 512, 455, 410, 372, 341, 315, 293, 273, 256, 241, 228, 216, 205, 195, 186, 178, 171, 164, 158, 152, 146, 141, 137, 132, 128, 124, 120, 117, 114, 111, 108, 105, 102, 100, 98, 95, 93, 91, 89, 87, 85, 84, 82, 80, 79, 77, 76, 74, 73, 72, 71, 69, 68, 67, 66, 65, 64
	},
//	.paraRSV.version = {FW_VERSION},
	.paraDataPrep.switch_flag = 0,
  
  .paraRSV.range_Set_outone = 100,
  .paraRSV.range_Set_outtwo = 200,  
};
